package com.campus.merchant.controller;

import com.campus.common.bean.common.Resp;
import com.campus.merchant.bean.data.BusinessDataQueryParam;
import com.campus.merchant.service.BusinessDataService;
import com.campus.merchant.vo.data.BusinessDataChartsVO;
import com.campus.merchant.vo.data.BusinessDataOverviewVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 经营数据Controller
 *
 * @author ZhaoYuJie
 * @since 2025-01-25
 */
@Api(tags = "经营数据管理")
@RestController
@RequestMapping("/business-data")
@RequiredArgsConstructor
public class BusinessDataController {

    private final BusinessDataService businessDataService;

    @ApiOperation("获取经营数据概览")
    @PostMapping("/overview")
    public Resp<BusinessDataOverviewVO> getBusinessDataOverview(@RequestBody @Validated BusinessDataQueryParam param) {
        BusinessDataOverviewVO overview = businessDataService.getBusinessDataOverview(param);
        return Resp.success(overview);
    }

    @ApiOperation("获取经营数据图表")
    @PostMapping("/charts")
    public Resp<BusinessDataChartsVO> getBusinessDataCharts(@RequestBody @Validated BusinessDataQueryParam param) {
        BusinessDataChartsVO charts = businessDataService.getBusinessDataCharts(param);
        return Resp.success(charts);
    }
}